class Service < ActiveRecord::Base
  belongs_to :user
  
  has_one :facebook_crawl
  has_one :lastfm_crawl
  has_one :youtube_crawl
  has_one :twitter_crawl
  has_one :blogspot_crawl
  has_one :flickr_crawl
  has_one :stumbleupon_crawl
  has_one :brightkite_crawl
  
  def crawl
    c = nil
    case self.ff_id
      when 'facebook'
      c = facebook_crawl
      when 'lastfm'
      c = lastfm_crawl
      when 'youtube'
      c = youtube_crawl
      when 'twitter'
      c = twitter_crawl
      when 'flickr'
      c = flickr_crawl
      when 'stumbleupon'
      c = stumbleupon_crawl
      when 'brightkite'
      c = brightkite_crawl
      when 'blog'
      c = blogspot_crawl unless /http:\/\/.*\.blogspot\.com\/?.*/.match(user_url_on_service).nil?
    end
    c
  end
  
end
